package com.example.travel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.travel.domain.entity.Files;
import com.example.travel.mapper.FileMapper;
import com.example.travel.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author : LinQingLiang
 * @file : FileServiceImpl.java
 * @Since : 2023/1/26 14:31
 */
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, Files> implements FileService {


    @Autowired
    private FileMapper fileMapper;

    @Override
    public Page page(Integer pageNum, Integer pageSize, String name) {
        Page page = new Page(pageNum,pageSize);

        QueryWrapper<Files> wrapper = new QueryWrapper();
        wrapper.like(name != null && name != "","name",name);
        wrapper.eq("is_delete","false");
        return fileMapper.page(page,wrapper);
    }
}
